package com.intramirror.product.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.web.http.HeaderHttpSessionIdResolver;
import org.springframework.session.web.http.HttpSessionIdResolver;

/**
 * Created on 2018/1/30.
 *
 * @author YouFeng.Zhu
 */
@Configuration
@EnableRedisHttpSession(redisNamespace = "spring:session:micro-service")
public class HttpSessionConfig {
    //    @Bean
    //    public HttpSessionStrategy httpSessionStrategy() {
    //        HeaderHttpSessionStrategy strategy = new HeaderHttpSessionStrategy();
    //        strategy.setHeaderName("token");
    //        return strategy;
    //    }

    @Bean
    public HttpSessionIdResolver httpSessionIdResolver() {
        return new HeaderHttpSessionIdResolver("token");
    }
}
